home *** CD-ROM | disk | FTP | other *** search
- Path: jacare.zk3.dec.com!zeeb
- From: zeeb@jacare.zk3.dec.com (Jeff Zeeb DEC C)
- Newsgroups: comp.lang.pl1,comp.lang.c
- Subject: Re: PL/I and C
- Date: 26 Feb 1996 14:41:49 GMT
- Organization: Digital Equipment Corporation
- Distribution: world
- Message-ID: <4gsgrd$v7u@zk2nws.zko.dec.com>
- References: <4gh5ru$eng@goanna.cs.rmit.EDU.AU> <312CCEB2.4AB7@corp.dialog.com> <AD536AAB9668B76CD@mcdialb09.it.luc.edu> <312E363C.3CDE@corp.dialog.com> <AD53AB1396681879FA@mcdialb10.it.luc.edu>
- Reply-To: zeeb@decc.enet.dec.com
- NNTP-Posting-Host: jacare.zk3.dec.com
- X-Newsreader: mxrn 6.18-32
-
-
- In article <AD53AB1396681879FA@mcdialb10.it.luc.edu>, VArase@varase.it.luc.edu (Verne Arase) writes:
-
- >... and BTW, you don't need to use a union; you can simply have several
- >pointers, each containing the same address. Just coerce them with a cast.
- >
- > foo *x;
- > bar *y;
- >
- > y=(bar *) x;
-
- This is dangerous territory. The code fragment above violates the
- aliasing rules in the ANSI C standard. In a nutshell, those rules
- state that a pointer to one type will not point to an object of a
- different type. An optimizer could generate code using this assumption,
- which would have unexpected results in your program.
-
- --
- Jeff Zeeb This article represents my opinions and not those
- zeeb@decc.enet.dec.com of Digital Equipment Corp. (Surprise!)
-